<?php
/**
 * Created by PhpStorm
 * User: honglin
 * Date: 2022/8/8
 * Time: 下午4:42
 */

namespace App\Listener\Ocean;

use App\Dao\Ocean\OceanTaskLogDao;
use App\Event\Ocean\OceanAd;
use App\Event\Ocean\OceanQuestion;
use App\Event\Ocean\OceanSignIn;
use App\Event\Ocean\OceanUserRubbishClear;
use Hyperf\Event\Annotation\Listener;
use Hyperf\Event\Contract\ListenerInterface;

/**
 * @Listener()
 */
class OceanTaskLogListener implements ListenerInterface
{

    public function listen(): array
    {
        return [
            OceanSignIn::class,
            OceanUserRubbishClear::class,
            OceanAd::class,
            OceanQuestion::class,
        ];
    }

    /**
     * @param object $event
     * @return void
     */
    public function process(object $event)
    {
        /** @var OceanSignIn $event */
        $event = $event;
        App(OceanTaskLogDao::class)->addLog($event->task_id, $event->user_id);
    }
}